package com.fileupload.server;

import java.io.File;
import java.io.IOException;

/**
 * 服务器连接接口
 * @author 小乙
 */
public interface Connection {
    /**
     * 连接到服务器
     */
    boolean connect() throws IOException;
    
    /**
     * 断开连接
     */
    void disconnect() throws IOException;
    
    /**
     * 检查连接是否活跃
     */
    boolean isConnected();
    
    /**
     * 上传文件
     */
    boolean uploadFile(File file, String remotePath, String remoteFileName) throws IOException;
    
    /**
     * 创建目录
     */
    boolean createDirectory(String directory) throws IOException;
    
    /**
     * 检查目录是否存在
     */
    boolean directoryExists(String directory) throws IOException;
    
    /**
     * 写入文本文件
     */
    boolean writeTextFile(String remotePath, String content) throws IOException;
    
    /**
     * 重命名远程文件
     */
    boolean renameFile(String oldFilePath, String newFilePath) throws IOException;
}